<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%--<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>--%>
<!DOCTYPE html>
<%String path = request.getContextPath();%>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>悦桔拉拉- 登录</title>
    <meta name="keywords" content="悦桔拉拉">
    <meta name="description" content="悦桔拉拉">
    <link href="<%=path%>/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=path%>/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="<%=path%>/admin/css/animate.css" rel="stylesheet">
    <link href="<%=path%>/admin/css/style.css" rel="stylesheet">
    <link href="<%=path%>/admin/css/login.css" rel="stylesheet">
    <link href="<%=path%>/admin/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <%--<script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>--%>

</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>[ 爱心商城 ]</h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong>悦桔拉拉后台登陆</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 项目流程</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 代码清晰</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 符合所学</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 直接购物</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 快速送达</li>
                </ul>
                <strong>还没有账号？ <a href="#">立即注册&raquo;</a></strong>
            </div>
        </div>
        <div class="col-sm-5">
            <form method="post" action="<%=path%>/gly?type=adminLogin">
                <h4 class="no-margins">登录：</h4>
                <p class="m-t-md">登录到悦桔拉拉</p>
                <c:if test="${name==null}">
                    <input type="text" class="form-control uname" placeholder="用户名" name="name" id="name1" />
                </c:if>
                <c:if test="${name!=null}">
                    <input type="text" class="form-control uname" value="${name}" placeholder="用户名" name="name"
                           id="name1" />
                </c:if>
                <!--判断是否输入用户名或密码-->
                <span id="pdMsg" style="color: red"></span>
                <input type="password" class="form-control pword m-b" placeholder="密码"  name="pwd" id="pwd"/><i class="fa fa-eye-slash"></i>
                <a href="">忘记密码了？</a>
                <%--用户名或密码输入错误提示--%>
                <c:if test="${msg != null}">
                    <span style="color: red;font-size: 14px" id="loginMsg">${msg}</span>
                </c:if>
                <button type="submit" id="submit" class="btn btn-success btn-block">登录</button>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2020 长沙科泰S2狗子团队项目盗版必究
        </div>
    </div>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" type="text/javascript"></script>
<script>
    //跳转管理员登入处理器
    /*$("#submit").click(function () {
        var name = $("[name='name']").val();
        var pwd = $("[name='pwd']").val();
        location.href='/gly?type=adminLogin&name='+name+"&pwd="+pwd;
    });*/
    //登入错误提示
    /*function ycMsg(){
        $("#loginMsg").show();
    }*/
    $(function () {
        var msg = $("#loginMsg");
        if(msg.text() != ""){
            //2s后隐藏
            setTimeout("ycMsg1()",2000);
        }
    });
    //隐藏提示文本
    function ycMsg1() {
        $("#loginMsg").hide();
    }
    //隐藏输入文本提示
    function ycMsg2() {
        $("#pdMsg").hide();
    }
    //给提示赋值
    function fz(a) {
        $("#pdMsg").show();
        $("#pdMsg").text(a);
    }
    //提示用户名是否输入
    function tsName() {
        var name = $("#name1").val();
        if (name==""){
            fz("请输入用户名！");
            setTimeout("ycMsg2()",2000);
            $("#name1").focus();
            return false;
        }
        return true;
    }
    //提示密码是否输入
    function tsPwd() {
        var pwd = $("#pwd").val();
        if (pwd==""){
            fz("请输入密码！");
            setTimeout("ycMsg2()",2000);
            $("#pwd").focus();
            return false;
        }
        return true;
    }
    //打开提交按钮
    function dk(){
        $("#submit").attr("disabled",false);
    }
    //用户名和密码输入正确就登入
    $("#submit").click(function () {
        //alert("1");
		if (tsName()&&tsPwd()){
		    //alert("2");
		    $("form").submit();
		}else {
		    //alert("3");
		    $("#submit").attr("disabled",true);
		    setTimeout("dk()",100);
        }
    });
</script>
</html>
